<?php
//生成二维码


//$parma['url']  = "http://www.baidu.com";
//$parma['name'] = "testimg";
//$parma['local'] = 'e:/site/athlon_yitong/uploadfiles/';
//$parma['size'] = 10;
//$parma['errorCorrectionLevel'] = "L";//容错级别


function creat_qrcode($parma){

    //此处必须要页面时印用了config中的静态变量才能使用
    include_once ROOT_PATH_ . '/application/phpqrcode/phpqrcode.php';



    //收拾参数，为生成二维码做准备
    $errorCorrectionLevel = 'L';//容错级别
    $matrixPointSize      = 10;//生成图片大小
    //win需要转码才能正确保存文件明
    $name = iconv("UTF-8", "Gb2312", $parma['name']);
    //组合生成图片保存位置及名字
    $img_name = $parma['local'] . $name . '.png';
    //生成二维码 -- 具体参数见下面说明
    QRcode::png($parma['url'], $img_name, $errorCorrectionLevel, $matrixPointSize, 2);


    $QR = $img_name;//已经生成的原始二维码图

    $str=iconv("Gb2312","UTF-8","中文");
    //输出图片
    imagepng($QR, $img_name);



    $result['name']  = $parma['name'];
    $result['local'] = $parma['local'];
    $result['url']   = $parma['url'];
    $result['parma'] = $parma;

    return $result;

//函数结束
}
?>